package com.inspur.demo.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.util.Date;

@Entity
//表名应该唯一
@Table(name = "db_user2")
@Getter
@Setter
@ToString(includeFieldNames = true)
@ApiModel(value = "用户数据模型", description = "描述用户的相关信息")

public class User2 {
    @Id
    @GeneratedValue(generator = "system-uuid")
    @GenericGenerator(name = "system-uuid", strategy = "uuid")
    @Column(name = "id", unique = true, nullable = false, length = 32)
    private String id;
    @ApiModelProperty(value = "书名")
    private String bookname;
    @ApiModelProperty(value = "数量")
    private Integer count;
    @Transient
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "入库日期")
    private Date date;

    public User2(String bookname, int count, Date date) {
        this.bookname = bookname;
        this.count = count;
        this.date = date;
    }

    public User2() {
    }
}
